find Abs in object text

Hello ,

i try to find the deleted Abs in object text , i consider that It_1 and It_3 deleted , my code should find It_2 and It_4 .

abs object text
It_1

IBM Rational DOORS

It_2 we can solve the problem with [It_1]
It_3

Operation:Compares strings

It_4 we can use [It_3] operation

 

 

Skip objList = create // create a skip list to store a list of absolute numbers
Object o
Module m = current
filtering off
string absNum
 
for o in current Module do  {// cycle through all object
    if (isDeleted(o)){ 
    accept o
    absNum = o."Absolute Number"
    put(objList, absNum, o) // store the absolute number for each object in the skip list 
    }
    else  
 reject o
  }
for o in objList do {
attribute "object text" == absNum 
 print "ID: "o."Absolute Number" " object deleted " "\n" 
} 
delete objList

 

 

 

i get just It_1 and It_3 als deleted , actually  my code should give It_4 and It_2 , have any one idea what is the problem ?

 

Thx


Control17 - Fri Jul 28 03:31:55 EDT 2017

Re: find Abs in object text
Mike.Scharnow - Fri Jul 28 04:12:55 EDT 2017

Hello Control17,

in this script you mix several concept of DOORS. accept/reject are used for filters, but I think you only want to print a list / create a skip list / give a warning.

Additionally, there are some problems in your script (see below), but I wonder if your general approach is good. You are trying to re-program something that DOORS does for you. Why do you not use links, e.g. of type "references" between it_2 and it_1? This way, DOORS would prevent your users from deleting objects that are referenced. The user would then have to adopt the referencing objects before the referenced object can be deleted. And you could create a traceability analysis automatically. And you could reference requirements stored in other modules.

Having said that, the problems that I find in your script are:

  • line 1: The key of your skip list of type "string", therefore you need to create the skip with createString
  • line 7: Usually DOORS does not show deleted objects, so you should better use a loop "for o in entire m" (or "entire current Module")
  • line 17: this is also a statement referring to filters, this will not work here. I think you want something like:
    • the currently scoped object has some information stored in its attribute "Object Text".
    • Analyse this information.
    • Find text inbetween [brackets], there might be more than one reference in the information.
    • For every found reference, check whether the number is contained in the skip list.
    • If the object is soft-deleted or if it does not exist in the skip list (hard deleted), give a warning

Regards
Mike

Re: find Abs in object text
Control17 - Fri Jul 28 05:48:20 EDT 2017

Mike.Scharnow - Fri Jul 28 04:12:55 EDT 2017

Hello Control17,

in this script you mix several concept of DOORS. accept/reject are used for filters, but I think you only want to print a list / create a skip list / give a warning.

Additionally, there are some problems in your script (see below), but I wonder if your general approach is good. You are trying to re-program something that DOORS does for you. Why do you not use links, e.g. of type "references" between it_2 and it_1? This way, DOORS would prevent your users from deleting objects that are referenced. The user would then have to adopt the referencing objects before the referenced object can be deleted. And you could create a traceability analysis automatically. And you could reference requirements stored in other modules.

Having said that, the problems that I find in your script are:

  • line 1: The key of your skip list of type "string", therefore you need to create the skip with createString
  • line 7: Usually DOORS does not show deleted objects, so you should better use a loop "for o in entire m" (or "entire current Module")
  • line 17: this is also a statement referring to filters, this will not work here. I think you want something like:
    • the currently scoped object has some information stored in its attribute "Object Text".
    • Analyse this information.
    • Find text inbetween [brackets], there might be more than one reference in the information.
    • For every found reference, check whether the number is contained in the skip list.
    • If the object is soft-deleted or if it does not exist in the skip list (hard deleted), give a warning

Regards
Mike

Hello,

Thank u Mike , i do not use links because i allready have a module with deleted object (with out link between Abs and Object text (reference )) ,

your solution for line 17 that is exactally what i need , i try to do that but i do not know which is the best funciton to find text .

is that possible with "findRichText" ?

bool findRichText(string s,string sub,int& offset,int& length,bool matchCase)

 

 

thank u very much for your support !

Regards, Neven

Re: find Abs in object text
Mike.Scharnow - Fri Jul 28 06:19:46 EDT 2017

Control17 - Fri Jul 28 05:48:20 EDT 2017

Hello,

Thank u Mike , i do not use links because i allready have a module with deleted object (with out link between Abs and Object text (reference )) ,

your solution for line 17 that is exactally what i need , i try to do that but i do not know which is the best funciton to find text .

is that possible with "findRichText" ?

bool findRichText(string s,string sub,int& offset,int& length,bool matchCase)

 

 

thank u very much for your support !

Regards, Neven

Hi Neven,

I did not understand your explanation where the problem is if you already have a linked module, why you still need to replicate this feature of DOORS, but to answer your question, you can use regular expressions with matches. See the DXL help or one of the many forum posts like e.g. Regexp dxl help for examples.

 

Regards,
Mike